package com.interceptor;

import com.hdb.TAdmin;
import com.hdb.TUser;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.ParentPackage;

import java.util.Map;

/**
 * Created by aszer on 2016/11/9.
 */

public class authenticationCheck extends MethodFilterInterceptor {

    @Override
    protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
        Map session = ServletActionContext.getContext().getSession();
        if (null == session || null == session.get("user"))
            return "login";
        return actionInvocation.invoke();
    }
}
